package com.example.hospitalsystem.controller;

import com.example.hospitalsystem.result.Result;
import com.example.hospitalsystem.service.EmailService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/email")
@Tag(name="3.邮箱模块")
public class EmailController {

    @Autowired
    private EmailService emailService;

    @Operation(summary = "登录验证码")
    @GetMapping("/captcha/login/{email}")
    public Result<Object> getCaptchaLogin(@PathVariable("email") String email){
        return emailService.getCaptchaLogin(email);
    }

    @Operation(summary = "绑定邮箱验证码")
    @GetMapping("/captcha/bindEmail/{email}")
    public Result<Object> bingdEmail(@PathVariable("email") String email){
        return emailService.bindEmail(email);
    }

    @Operation(summary = "密码修改验证码")
    @GetMapping("/change/pwd/{email}")
    public Result<Object> changePwd(@PathVariable("email") String email){
        return emailService.changePwd(email);
    }

    @Operation(summary = "旧邮箱验证码")
    @GetMapping("/getOldCaptcha/{email}")
    public Result<Object> getOldCaptcha(@PathVariable("email") String email){
        return emailService.getOldCaptcha(email);
    }

    @Operation(summary = "新邮箱验证码")
    @GetMapping("/getNewCaptcha/{email}")
    public Result<Object> getNewCaptcha(@PathVariable("email") String email){
        return emailService.getNewCaptcha(email);
    }
}
